﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FilStartUps.FILAPI;

namespace FilStartUps.Controls
{
    public partial class FilStartUps_EventDetails : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GetEventDetails(Convert.ToInt32(Request.QueryString["id"].Trim()));
            }
        }

        private void GetEventDetails(int eventid)
        {
           
                var event_ = FilStartUpsAPI.GetEventDetail(eventid);
                lbeventtitle.Text = event_.eventtitle;
                lbEventStart.Text = ConvertDate(event_.startdate.ToString());
                lbEventEnd.Text = ConvertDate(event_.enddate.ToString());
                lteventdetails.Text = event_.eventdescription;
          

        }
        public string ConvertDate(string date)
        {
            string date_;
            try
            {
                DateTime _date = Convert.ToDateTime(date);
                date_ = _date.ToShortDateString();//String.Format("{0:d/M/yyyy}", date);
            }
            catch
            {
                date_ = date.ToString();
            }
            return date_;
        }
    }
}